<template>
  <div class='vessel'>
    <div class="head">
      <h3>用户列表</h3>
      <el-button type="primary">添加</el-button>
    </div>
    <el-table :data="tableData" style="width: 100%">
      <el-table-column label="序号" width="180" prop="id">
      </el-table-column>
      <el-table-column label="用户名" width="180" prop="username">
      </el-table-column>
      <el-table-column label="手机" width="180" prop="mobile">
      </el-table-column>
      <el-table-column label="邮箱" width="180" prop="email">
      </el-table-column>
      <el-table-column label="性别" width="180" prop="gender">
      </el-table-column>
      <el-table-column label="状态" width="180" prop="status">
      </el-table-column>
      <el-table-column label="操作">
        <template #default="scope">
          <el-button type="primary">编辑</el-button>
          <el-button type="primary">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination background v-model:current-page="currentPage4" :total="1000" @current-change="handleCurrentChange" />
  </div>
</template>
<script setup>
import { ref } from 'vue'
import { getUserApi } from '@/api/user'

const tableData = ref([])
const currentPage4 = ref()

const handleCurrentChange = (res => {
  console.log("current", res)
  currentPage4.value = res
  getUserApi({ page: res }).then(res => {
    console.log("res", res);
    tableData.value = res.data.paginate.data
    console.log(tableData.value);
  })
})




getUserApi().then(res => {
  console.log(res)
  tableData.value = res.data.paginate.data
  console.log(tableData.value)
})
</script>
<style lang='scss' scoped>
.head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
</style>
